/**
*      author: Y_Yao
*      created: 2024-11-16 17:52:19
**/

#include<bits/stdc++.h>

using namespace std;
#define int LL
using LL = long long;
const LL LLINF = 1e18;
const int INF = 0x3f3f3f3f;
const int N = 10 + 5;
int h,w,k;
int dx[4] = {0,0,1,-1};
int dy[4] = {-1,1,0,0};
int ret;
vector<string> s(N);

void bfs(int i,int j,int cnt)
{
    if(cnt == 0)
    {
        ret++;
        return;
    }
    s[i][j] = '#';
    for(int m = 0;m < 4;m++)
    {
        int x = i + dx[m],y = j + dy[m];
        if(x < 1 || y < 0 || x >= h + 1 || y >= w || s[x][y] == '#') continue;
        bfs(x,y,cnt - 1);
    }
    s[i][j] = '.';
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> h >> w >> k;
    for(int i = 1;i <= h;i++)
    {
        cin >> s[i];
    }

    // for(int i = 1;i <= h;i++)
    // {
    //     cout << s[i] << endl;
    // }
    for(int i = 1;i <= h;i++)
    {
        for(int j = 0;j < w;j++)
        {
            if(s[i][j] == '#') continue;
            bfs(i,j,k);
        }
    }

    cout << ret << endl;
    return 0;
}